// pages/rechargeRecord/rechargeRecord.js
const app = getApp();
var util = require('../../utils/util.js');
Page({
  data: {
    modal: {
      toastHidden: true,
      msg: ""
    },
    pageNum: 1,
    pageSize: 20,
    content: [
      // { money: "10", date: "2017-12-20 8:20",num:"2014850230" },
    ]
  },
  onLoad: function (options) {
  },
  onShow: function () {
    var that = this;
    var data = {
      crrerUser: app.globalData.userUuid,
      pageNum: that.data.pageNum,
      pageSize: that.data.pageSize

    };
    util.requestGet("coreRechargeRecord/find/my/page", data, function (res) {
      if (res.success) {
        var new_content = [];
        var obj = {};
        for (var i = 0; i < res.data.result.length; i++) {
          var obj = {};
          obj.num = res.data.result[i].crrerOrder;
          obj.money = res.data.result[i].crrerFee;
          obj.date = util.formatTime(res.data.result[i].crrerDate);
          new_content.push(obj);
        }
        that.setData({ "content": new_content });
      } else {

      }

    }, function (errData) {
      that.setData({ "modal.toastHidden": false, "modal.msg": '当前网格异常，请稍后再试' });
    });
  },
  onHide: function () {

  },
  onPullDownRefresh: function () {

  },

  onReachBottom: function () {

  },
  toastChange() {
    this.setData({ "modal.toastHidden": true });
  }
})